﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace TcpClient
{
    class Program
    {
        public static object IPAdress { get; private set; }

        static void Main(string[] args)
        {
            // 客户端创建用于通信的套接字
            Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            // 要连接的服务端的ip和端口
            IPAddress ip = new IPAddress(new byte[] { 10, 3, 5, 21 });
            IPEndPoint iPEndPoint = new IPEndPoint(ip, 8000);
            // 连接
            socket.Connect(iPEndPoint);
            while(true)
            {
                string str = Console.ReadLine();
                int length = socket.Send(Encoding.UTF8.GetBytes(str));
            }

            socket.Close();
            
        }
    }
}
